#include "SandboxScene.hpp"

SandboxScene::SandboxScene() {
    SpotlightElement* light = this->createSpotlight(0.0f, 4.0f, 3.0f * b2_pi / 2.0f, b2_pi / 4.0f, 10.0f, LightElement::slipperyLight);
    SpotlightElement* light2 = this->createSpotlight(-4.0f, 0.0f, b2_pi / 2.0f, b2_pi / 8.0f, 10.0f, LightElement::repulsiveLight);
    light2->setState(true);
    SpotlightElement* light3 = this->createSpotlight(7.0f, -2.5f, 5.0f * b2_pi / 4.0f, b2_pi / 8.0f, 10.0f, LightElement::elasticLight);
    light3->setState(true);

    b2Vec2 vertices[8];
    vertices[0].Set(-9.5f, -5.0f);
    vertices[1].Set(9.5f, -5.0f);
    vertices[2].Set(9.5f, -3.0f);
    vertices[3].Set(7.5f, -3.0f);
    vertices[4].Set(7.5f, 5.0f);
    vertices[5].Set(-7.5f, 5.0f);
    vertices[6].Set(-7.5f, -3.0f);
    vertices[7].Set(-9.5f, -3.0f);

    this->createRoom(1, vertices, 8);

    BoxElement* box = this->createBox(0.0f, 0.0f);
    box->body->SetAngularVelocity(2.0f);

    b2Vec2 pvertices[4];
    pvertices[0].Set(-7.5f, 0.0f);
    pvertices[1].Set(-6.0f, 0.0f);
    pvertices[2].Set(-5.0f, -0.2f);
    pvertices[3].Set(-1.0f, -0.2f);
    this->createPlatform(pvertices, 4);

    /*b2Vec2 mpvertices[4];
    mpvertices[0].Set(-1.0f, 0.5f);
    mpvertices[1].Set(-0.5f, 0.0f);
    mpvertices[2].Set(0.5f, 0.0f);
    mpvertices[3].Set(1.0f, 0.5f);
    MoveablePlatformElement* moveablePlatform = this->createMoveablePlatformElement(mpvertices, 4, b2Vec2(0.0f, -1.0f), b2Vec2(0.0f, 1.0f), 0.1f);*/

    this->hero = this->createHero(-9.5f + HeroElement::WIDTH / 2.0f, -5.0f + HeroElement::HEIGHT / 2.0f);

    this->start = this->createDoor(-7.5f, -4.0f, -1.0f);
    DoorElement* door = this->createDoor(7.5f, -4.0f, 1.0f);

    SwitchElement* s = this->createSwitch(-5.5f, -5.0f, 0.0f, light);
    s->addActionableElement(door);
    s->addActionableElement(light3);
    //s->addActionableElement(moveablePlatform);
}
